import java.util.Random;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 62536
 * Date: 2023-10-29
 * Time: 18:51
 */
public class Test {

    public static void main(String[] args) {

    }

    //求一个数的二进制形式的奇偶位
    public static void main6(String[] args) {
        int n = 9;
        for (int i = 30; i >= 0; i -= 2) {
            System.out.print(((n >> i) & 1) +" ");
        }
        System.out.println();
        for (int i = 31; i > 0; i -= 2) {
            System.out.print(((n >> i) & 1) +" ");
        }
    }

    //求一个数的二进制形式的1的个数
    public static void main5(String[] args) {
        int n = 7;
        int count = 0;
        while(n != 0){
            if((n & 1) == 1){
                count++;
            }
            n >>>= 1;    //无符号右移，防止n是负数
        }
        System.out.println(count);
    }


    //求两个数最大公约数的最优解  辗转相除法
    public static void main4(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = a % b;
        while(c != 0){
            a = b;
            b = c;
            c = a % b;
        }
        System.out.println(b);
    }

    //猜数字
    public static void main3(String[] args) {
        Random random = new Random();
        int randNum =  random.nextInt(100);
        while(true){
            Scanner scanner =new Scanner(System.in);
            int a = scanner.nextInt();
            if(a < randNum){
                System.out.println("猜小了");
            } else if(a > randNum){
                System.out.println("猜大了");
            }else{
                System.out.println("猜对了");
                break;
            }

        }
    }

    //找到100以内能被3整除且能被5整除的数字
    public static void main2(String[] args) {
        int i = 1;
        while(i < 101){
            if(i % 15 != 0){
                i++;
                continue;
            }
            System.out.print(i +" ");
            i++;

        }
    }
}
